package com.example.day06;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;

public class HashMapTest {
    public static void main(String[] args) {
        HashMap<Integer, String> map = new HashMap<>();
        map.put(1, "abc");
        map.put(100, "abcde");
        System.out.println(map.size());

        for (Map.Entry<Integer, String> integerStringEntry : map.entrySet()) {
            System.out.println(integerStringEntry.getKey() + " -> " + integerStringEntry.getValue());
        }

        System.out.println(map.get(100));

        LinkedHashMap<Integer, String> map1 = new LinkedHashMap<>();
        map1.put(1, "a");
        map1.put(2, "a");
        map1.put(3, "a");

        TreeMap<Integer, Double> map2 = new TreeMap<>();
        map2.put(3, 1.23D);
        map2.put(1, 2.56D);
        map2.put(2, 0.12D);

        for (Integer integer : map2.keySet()) {
            System.out.println(integer + " -> " + map2.get(integer));
        }
    }
}
